<?php
namespace Ygcl\Service;
use Think\Model;
class ClassService extends Model {
	
	private $m;
	
	function __construct(){
		$this->m = D('YgclClass');
	}
	
	public function _create_cache_class(){
		$xiaoqu = F('Xiaoqu/xiaoqu');
		foreach ($xiaoqu as $xq){
			$map['status'] = 1;
			$data = $this->m->where(array('status'=>1,'did'=>$xq['id']))->order('listorder desc,id desc')->select();
			F('Class/xq_'.$xq['id'].'/ClassData',$data);
		}
	}
	
	public function _create_cache_classtype($cid){
		$data = D('YgclClassType')->where(array('status'=>1,'cid'=>$cid))->select();
		F('ClassType/classtype_'.$cid,$data);
	}
	
	public function _create_cache_class_classtype(){
		$xiaoqu = F('Xiaoqu/xiaoqu');
		foreach ($xiaoqu as $xq){
			$data = $this->m->where(array('status'=>1,'did'=>$xq['id']))->order('listorder desc,id desc')->select();
			F('Class/xq_'.$xq['id'].'/ClassData',$data);
			foreach ($data as $dt){
				$info= D('YgclClassType')->where(array('status'=>1,'cid'=>$dt['id']))->select();
				F('ClassType/classtype_'.$dt['id'],$info);
			}
		}
	}
   
}